import Vue from 'vue'

const GlobalComponentsContext = require.context('./global', true, /\.vue$/)

GlobalComponentsContext.keys().forEach(componentPath => {
  const componentCfg = GlobalComponentsContext(componentPath)

  const ctrl = componentCfg.default || componentCfg
  const name = ctrl.extendOptions.name || ctrl.name
  console.log('global_name:', name)
  Vue.component(name, ctrl)
})
